
from common.db_util import MySqlDb

if __name__ == '__main__':
    # 查询第2页，每页3条
    result = MySqlDb.query_by_page(
        "SELECT * FROM blog_article WHERE status=:status",
        {'status': 1},
        page=1,
        page_size=3
    )
    print("测试分页查询",result)

#查询一条数据
    result = MySqlDb.query_one(
        "SELECT * FROM blog_article WHERE status=:status",
        {'status': 1}
    )
    print("测试查询一条数据",result)
    #查询数据（非分页）
    result = MySqlDb.query(
        "SELECT * FROM blog_article WHERE status=:status",
        {'status': 1}
    )
    print("测试查询数据（非分页）",result)
    # 修改数据
    result = MySqlDb.update(
        "UPDATE blog_article SET title=:title WHERE id=:id",
        {'title': 'Python3', 'id': 1}
    )
    print("测试修改数据",result)
    from blog.mydb_util import Article




